package org.wlw.io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class TestObjectOutputStream {
	public static void main(String[] args) {
		ObjectOutputStream oos = null;
		
		try {
			Person person = new Person();
			person.age = 22;
			person.name = "张三";
			person.money = 1000;
			System.out.println(person);
			oos = new ObjectOutputStream(new FileOutputStream("d:/test/23wlw/person.sav"));
			oos.writeObject(person);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if(oos!=null) {
					oos.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}